<template>
  <el-dialog
    :title="form.id?(isDetail?'详情':'编辑'):'新增'"
    :visible.sync="dialogVisible"
    :before-close="close"
    width="40%"
  >
    <el-form :disabled="isDetail" label-width="100px">
      <el-form-item label="类别名称">
        <el-input size="mini" placeholder="请输入" />
      </el-form-item>
      <el-form-item label="提醒范围">
        <el-select size="mini">
          <el-option />
        </el-select>
      </el-form-item>
      <el-form-item label="提醒周期设置">
        <el-select size="mini">
          <el-option />
        </el-select>
      </el-form-item>
      <el-form-item label="提醒方式">
        <el-radio-group>
          <el-radio label="1">自动提醒</el-radio>
          <el-radio label="2">手动提醒</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="是否启用">
        <el-select size="mini">
          <el-option label="是" value="1" />
          <el-option label="否" value="2" />
        </el-select>
      </el-form-item>
    </el-form>
    <span v-if="!isDetail" slot="footer" class="dialog-footer">
      <el-button type="primary" @click="confirm">确 定</el-button>
      <el-button @click="close">取 消</el-button>
    </span>
  </el-dialog>
</template>
<script>
export default {
  data () {
    return {
      dialogVisible: false,
      form: {},
      isDetail: false
    }
  },
  methods: {
    open (row, isDetail) {
      this.isDetail = isDetail
      this.form = { ...row }
      this.dialogVisible = true
    },
    confirm () {
      this.$emit('getData')
    },
    close () {
      this.form = {}
      this.dialogVisible = false
    }
  }
}
</script>
<style lang="scss" scoped>
  .titleStyle {
    font-weight: 600;
    height: 35px;
    line-height: 35px;
    padding-left: 10px;
    padding-right: 10px;
    margin-bottom: 8px;
    background-color: #d8eff9;
    display: flex;
    justify-content: space-between;
  }
  .upload-demo {
    display: inline-block !important;
    margin-left: 16px;
  }
</style>
